package com.jerp.context;

import java.util.Map;

import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.Initiator;

import com.jerp.ui.auth.UserCredential;
import com.jerp.ui.main.UserUIManager;

public class AuthenticationInit implements Initiator {

	@Override
	public void doInit(Page arg0, Map<String, Object> arg1) throws Exception {
		Object usrCred = Sessions.getCurrent().getAttribute(
				UserUIManager.USR_CRED);
		if (usrCred == null) {
			Executions.sendRedirect("/login.zul");
		}
	}

}
